﻿<!--*************************************************************************************

   Toolkit for WPF

   Copyright (C) 2007-2016 Xceed Software Inc.

   This program is provided to you under the terms of the Microsoft Public
   License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license 

   For more features, controls, and fast professional support,
   pick up the Plus Edition at https://xceed.com/xceed-toolkit-plus-for-wpf/

   Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids

  ************************************************************************************-->

<local:DemoView x:Class="Xceed.Wpf.Toolkit.LiveExplorer.Samples.Text.Views.RichTextboxView"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:sys="clr-namespace:System;assembly=mscorlib"
                 xmlns:local="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer"
                 xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
                 xmlns:rich="clr-namespace:Xceed.Wpf.Toolkit.LiveExplorer.Samples.Text.Views"
                 Title="RichTextBox">
    <local:DemoView.Description>
        <Paragraph FontSize="14" FontFamily="Segoe">
           The RichTextBox is a TextBox that allows you to edit formatted text based on TextFormatters. The RichTextBoxFormatBar is a contextual formatting toolbar that mimics the behavior of the Microsoft Office 2010 formatting bar on selection.
        </Paragraph>
    </local:DemoView.Description>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <GroupBox Header="Features" Grid.Row="0" Margin="5">
            <Grid Margin="5" HorizontalAlignment="Left">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <TextBlock Text="TextFormatter:" VerticalAlignment="Center" />
                <ComboBox x:Name="_textFormatter" SelectedIndex="0" SelectionChanged="OnTextFormatterChanged" Grid.Column="1" Width="150" Margin="5" HorizontalAlignment="Left">
                    <ComboBoxItem Tag="{x:Static rich:TextFormatterEnum.PlainText}">Plain Text</ComboBoxItem>
                    <ComboBoxItem Tag="{x:Static rich:TextFormatterEnum.Rtf}">RTF</ComboBoxItem>
                    <ComboBoxItem Tag="{x:Static rich:TextFormatterEnum.Xaml}">Xaml</ComboBoxItem>
                </ComboBox>
                <TextBlock Text="Text:" Grid.Row="1" VerticalAlignment="Center"/>
                <TextBox x:Name="_text" Grid.Row="1" Grid.Column="1" TextWrapping="Wrap" IsReadOnly="True" Width="500" Height="70" Margin="5" ScrollViewer.VerticalScrollBarVisibility="Auto"
                         Text="{Binding ElementName=_richTextBox, Path=Text, Mode=OneWay}"/>
             </Grid>
        </GroupBox>

        <StackPanel Grid.Row="1" Margin="10">
            <TextBlock Text="Usage:" Style="{StaticResource Header}" />
            <xctk:RichTextBox x:Name="_richTextBox" Grid.Column="1" Margin="5" BorderBrush="Gray" Padding="10" Width="350" >
               <xctk:RichTextBoxFormatBarManager.FormatBar>
                    <xctk:RichTextBoxFormatBar />
                </xctk:RichTextBoxFormatBarManager.FormatBar>
            <xctk:RichTextBox.Document>
               <FlowDocument>
                  <Paragraph>This is the <Bold>RichTextBox </Bold>!</Paragraph>
               </FlowDocument>
            </xctk:RichTextBox.Document>
         </xctk:RichTextBox>
        </StackPanel>
    </Grid>
</local:DemoView>
